<?php
require_once("xforms/Core.php");

class FrOrbeon_Section extends XForms_Core{
  protected $tpl='<div class="frorbeon_section {renderClass}"><div class="orbeonPanel" {renderId}><h3>{renderLabel}</h3><div>{renderChildNodes}</div></div></div>';
  protected $script = '.append(new FrOrbeon_section({renderJson}))';
  function renderClass(){
    $cssClass="";
    $binding = $this->getBinding();
    if($binding && $binding->getAttribute("relevant")) {
      $xBinding = $this->getXElement($binding);
      switch($xBinding->evalAttribute("relevant")){
        case true: break;
        case false: $cssClass= $cssClass . " xforms_nonvisible";break;
        default:
      }
    }
    return $cssClass;
  }
  function renderLabel(){
    return parent::renderChildNodes(array('xforms:label'));
  }
  function renderChildNodes($whiteList=array(), $blackList=array(), $glue = ''){
    return parent::renderChildNodes(array(),array('xforms:label','xforms:help'));
  }
}
